package de.jonasblatt.networkapi.rpi.network.commands.client;

import de.jonasblatt.networkapi.rpi.model.RpiWorker;
import de.jonasblatt.networkapi.rpi.network.commands.ClientCommand;
import de.jonasblatt.networkapi.rpi.network.commands.server.SCSendGpioValue;
import de.jonasblatt.networkapi.rpi.network.server.Server;

public class CCRequestGpioValue implements ClientCommand {

	private int clientId;
	private String gpio;

	public CCRequestGpioValue(int clientId, String gpio) {
		this.clientId = clientId;
		this.gpio = gpio;
	}

	@Override
	public void execute(Server server) {
		RpiWorker rpiWorker = (RpiWorker) server.getModel();

		server.updateClient(this.clientId, new SCSendGpioValue(this.gpio, rpiWorker.getGpioworker().getGpioValue(this.gpio)));
	}
}
